package com.easychat.entity.enums;

/**
 * @Author: yudaxian
 * @Description: TODO
 * @DateTime: 2024/8/6 23:53
 **/
public enum UserStatusEnum {
    DISABLE(0, "禁用"),
    ENABLE(1, "启用"),
    ;
    private Integer code;
    private String desc;

    UserStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static UserStatusEnum getByStatus(Integer status) {
        try {
            for (UserStatusEnum item : UserStatusEnum.values()) {
                if (item.getCode().equals(status)) {
                    return item;
                }
            }
            return null;
        } catch (Exception e) {
            return null;
        }
    }
}
